<template>
	<view>
		<u-empty
			mode="list"
			text="即将发布，敬请期待哦"
			:iconSize="100"
			:textSize="28"
			:show="!routesList.length"
		>
		</u-empty>
		
		<view class="routes-list">
			<view class="routes-item flex" v-for="(sitem,skey) in routesList" @click="goRouteDetails(sitem)" :key="skey" v-if="skey<(renderNums>0?renderNums:routesList.length)">
				<view class="route-cover-wrap">
					<u-image 
						width="220" 
						height="220" 
						:src="sitem.cover" 
						radius="20" 
						shape="square"
						:lazy-load="true"
						>
					</u-image>
				</view>
				<view class="route-info flex">
					<view class="route-title">
						<view class="main uni-ellipsis-2">
							<u-text :lines="2" :size="32" :bold="true" :text="sitem.route_name"></u-text>
						</view>
						<view class="label-list flex">
							<view class="label-item" v-for="(label,lKey) in sitem.label" :key="lKey">
								{{ label }}
							</view>
						</view>
					</view>
					
					<view class="route-price flex">
						<view class="price-info flex">
							<text class="symbal">￥</text>
							<text class="main">{{ sitem.prime_price > 0 ? sitem.prime_price : sitem.price }}</text>
							<text class="unit">/人 起</text>
						</view>
						<view class="go-buy">去购买</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"ftx-routes",
		props: {
			routesList: {
				type: Array,
				default: []
			},
			renderNums: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			goRouteDetails: function(route) {
				uni.navigateTo({
					url: `/pages/routes/details?route_id=${route.id}`,
				});
			}
		}
	}
</script>

<style lang="scss">
.routes-list {
	margin-bottom: 30rpx;
	.routes-item {
		padding: 30rpx 0 22rpx 0;
		.route-info {
			flex: 1;
			flex-direction: column;
			justify-content: space-between;
			height: 100%;
			margin-left: 24rpx;
			.route-title {
				.main {
					font-size: 32rpx;
				}
				.label-list {
					margin-top: 12rpx;
					flex-wrap: wrap;
					.label-item {
						font-size: 24rpx;
						padding: 4rpx 10rpx;
						background-color: #f5fff0;
						border-style: solid;
						border-width: 1px;
						border-color: #5ac725;
						color: #5ac725;
						border-radius: 10rpx;
						margin-right: 14rpx;
						margin-bottom: 14rpx;
					}
				}
			}
			
			.route-price {
				justify-content: space-between;
				align-items: center;
				.price-info {
					font-size: 30rpx;
					color: #ff5a5f;
					align-items: baseline;
					.symbal {
						
					}
					.main {
						font-size: 40rpx;
						font-weight: bold;
					}
					.unit {
						color: #999;
					}
				}
				.go-buy {
					background: linear-gradient(to right, #8bc34ae0, #219508);
					color: #fff;
					font-size: 28rpx;
					padding: 10rpx 22rpx;
					border-radius: 30rpx;
				}
			}
		}
	}
}
</style>